package com.junzerg.tooltip.entity.dao;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.junzerg.tooltip.entity.dto.ConvDto;
import lombok.Data;

import java.sql.Time;
import java.sql.Timestamp;

/**
 * @author pengjz <br>
 * @version 1.0 <br>
 * @description ConvDao <br>
 * @date 2022/4/7 14:00 <br>
 */
@Data
@TableName("tooltip_conv")
public class ConvDao {
    @TableField("id")
    private Integer id;
    @TableField("province")
    private String province;
    @TableField("city")
    private String city;
    @TableField("`distinct`")
    private String distinct;
    @TableField("address")
    private String address;
    @TableField("report_date")
    private Timestamp reportDate;
    @TableField("created_at")
    private Timestamp createdAt;
    @TableField("updated_at")
    private Timestamp updatedAt;

    public ConvDto buildDto() {
        return ConvDto.builder()
                .id(this.id)
                .province(this.province)
                .city(this.city)
                .distinct(this.distinct)
                .address(this.address)
                .reportDate(DateUtil.formatDate(this.reportDate))
                .build();
    }
}
